import React from 'react';
import { Provider } from 'react-redux';
import { BrowserRouter as Router } from 'react-router-dom';
import { ConfigProvider } from 'antd';
import zhCN from 'antd/es/locale/zh_CN';
import Routes from './routers'; // 路由
import store from './store';

// import './app.less';

function App() {
  return (
    <ConfigProvider locale={zhCN}>
      <Provider store={store}>
        <Router basename="/demospa/">
          <Routes />
        </Router>
      </Provider>
    </ConfigProvider>
  );
}

// 解决：ios12 键盘下落 页面不下落
// const { userAgent } = navigator;
// const u = userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
// if (u) {
//   document.body.addEventListener('focusout', () => {
//     setTimeout(() => {
//       const scrollHeight = document.documentElement.scrollTop || document.body.scrollTop || 0;
//       window.scrollTo({
//         top: Math.max(scrollHeight - 1, 0),
//         behavior: 'smooth',
//       });
//     }, 100);
//   });
// }

export default App;
